/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.modules.dqhrm.domain;

import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.persistence.*;
import javax.validation.constraints.*;
import javax.persistence.Entity;
import javax.persistence.Table;

import lombok.Getter;
import lombok.Setter;
import me.zhengjie.base.BaseEntity;
import me.zhengjie.modules.dqhrm.util.Gender;
import me.zhengjie.modules.system.domain.User;
import org.hibernate.annotations.*;
import java.sql.Timestamp;
import java.math.BigDecimal;
import java.io.Serializable;
import java.util.Objects;

/**
* @website https://eladmin.vip
* @description /
* @author Kuki Wu
* @date 2024-12-06
**/
@Entity
@Getter
@Setter
@Data
@Table(name="dq_doctors")
public class DqDoctors extends BaseEntity implements Serializable {

    @Id
    @NotNull(groups = BaseEntity.Update.class)
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "`doctor_id`")
    @ApiModelProperty(value = "主键ID")
    private Long id;

    @Column(name = "`real_name`",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "姓名")
    private String realName;

    @Column(name = "`nick_name`",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "昵称")
    private String nickName;


    @Column(name = "`avatar_name`")
    @ApiModelProperty(value = "头像真实名称",hidden = true)
    private String avatarName;

    @Column(name = "`avatar_path`")
    @ApiModelProperty(value = "头像存储的路径", hidden = true)
    private String avatarPath;

    @Column(name = "`img`")
    @ApiModelProperty(value = "个性展示图片", hidden = true)
    private String img;

    @Column(name = "`wx_name`")
    @ApiModelProperty(value = "微信名")
    private String wxName;

    @Column(name = "`wx_no`")
    @ApiModelProperty(value = "微信号")
    private String wxNo;

    @Column(name = "`wx_openid`")
    @ApiModelProperty(value = "微信OpenID号")
    private String wxOpenid;

    @Column(name = "`phone_number`",unique = true,nullable = false)
    @NotBlank
    @ApiModelProperty(value = "电话号码")
    private String phoneNumber;

    @Column(name = "`id_card_number`",unique = true,nullable = false)
    @NotBlank
    @ApiModelProperty(value = "身份证号")
    private String idCardNumber;

    @Column(name = "`dq_hrm_password`",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "本平台登录密码")
    private String dqHrmPassword;

    @Column(name = "`birth_date`")
    @ApiModelProperty(value = "出生年月日")
    private Timestamp birthDate;

    //@Enumerated(EnumType.STRING)
    @Column(name = "`gender`")
    @ApiModelProperty(value = "性别")
    private String gender;

    @Column(name = "`ethnicity`")
    @ApiModelProperty(value = "民族")
    private String ethnicity;

    @Column(name = "`id_card_province`")
    @ApiModelProperty(value = "身份证省份")
    private String idCardProvince;

    @Column(name = "`id_card_address`")
    @ApiModelProperty(value = "身份证地址")
    private String idCardAddress;

    @Column(name = "`email`")
    @ApiModelProperty(value = "电子邮箱")
    private String email;

    @Column(name = "`physician_title`")
    @ApiModelProperty(value = "医师职称")
    private String physicianTitle;

    @Column(name = "`registered_department`")
    @ApiModelProperty(value = "注册科室")
    private String registeredDepartment;

    @Column(name = "`title_registration_scope`")
    @ApiModelProperty(value = "医师职称注册范围")
    private String titleRegistrationScope;

    @Column(name = "`title_certificate_number`")
    @ApiModelProperty(value = "医师职证称编号")
    private String titleCertificateNumber;

    @Column(name = "`practice_certificate_obtained_date`")
    @CreationTimestamp
    @ApiModelProperty(value = "医师证执业证获取时间")
    private Timestamp practiceCertificateObtainedDate;

    @Column(name = "`original_registration_province`")
    @ApiModelProperty(value = "医师证原注册单位省份")
    private String originalRegistrationProvince;

    @Column(name = "`original_registration_city`")
    @ApiModelProperty(value = "原注册单位城市")
    private String originalRegistrationCity;

    @Column(name = "`original_registration_unit_name`")
    @ApiModelProperty(value = "医师证原注册单位名称")
    private String originalRegistrationUnitName;

    @Column(name = "`original_registration_unit_level`")
    @ApiModelProperty(value = "医师证原注册单位级别")
    private String originalRegistrationUnitLevel;

    @Column(name = "`hospital_nature`")
    @ApiModelProperty(value = "医师证医院性质")
    private String hospitalNature;

    @Column(name = "`qualification_certificate_number`")
    @ApiModelProperty(value = "医师资格证编号")
    private String qualificationCertificateNumber;

    @Column(name = "`qualification_obtained_date`")
    @CreationTimestamp
    @ApiModelProperty(value = "资格证获取时间")
    private Timestamp qualificationObtainedDate;

    @Column(name = "`specialty_category`")
    @ApiModelProperty(value = "专业类别")
    private String specialtyCategory;

    @Column(name = "`graduation_school`")
    @ApiModelProperty(value = "毕业学校")
    private String graduationSchool;

    @Column(name = "`education_level`")
    @ApiModelProperty(value = "学历")
    private String educationLevel;

    @Column(name = "`physician_license_number`")
    @ApiModelProperty(value = "医师执业证编号")
    private String physicianLicenseNumber;

    @Column(name = "`pharmacist_specialty_category`")
    @ApiModelProperty(value = "药师专业类别")
    private String pharmacistSpecialtyCategory;

    @Column(name = "`pharmacist_qualification_certificate_number`")
    @ApiModelProperty(value = "药师咨格证编号")
    private String pharmacistQualificationCertificateNumber;

    @Column(name = "`pharmacist_management_number`")
    @ApiModelProperty(value = "药师管理号")
    private String pharmacistManagementNumber;

    @Column(name = "`pharmacist_registration_certificate_number`")
    @ApiModelProperty(value = "药师注册证编号")
    private String pharmacistRegistrationCertificateNumber;

    @Column(name = "`pharmacist_issuing_unit`")
    @ApiModelProperty(value = "药师证签发单位")
    private String pharmacistIssuingUnit;

    @Column(name = "`pharmacist_practice_category`")
    @ApiModelProperty(value = "药师执业类别")
    private String pharmacistPracticeCategory;

    @Column(name = "`pharmacist_practice_scope`")
    @ApiModelProperty(value = "药师执业范围")
    private String pharmacistPracticeScope;

    @Column(name = "`pharmacist_registration_address`")
    @ApiModelProperty(value = "药师注册地址")
    private String pharmacistRegistrationAddress;

    @Column(name = "`personal_profile`")
    @ApiModelProperty(value = "个人简介")
    private String personalProfile;

    @Column(name = "`specialties_and_diseases`")
    @ApiModelProperty(value = "擅长科室及疾病用药")
    private String specialtiesAndDiseases;

    @Column(name = "`other_medical_certificates`")
    @ApiModelProperty(value = "其他医疗相关证件")
    private String otherMedicalCertificates;

    @Column(name = "`bank_name`")
    @ApiModelProperty(value = "开户行")
    private String bankName;

    @Column(name = "`bank_account_number`")
    @ApiModelProperty(value = "银行卡帐号")
    private String bankAccountNumber;

    @Column(name = "`total_revenue`")
    @ApiModelProperty(value = "总收入")
    private BigDecimal totalRevenue;

    @Column(name = "`grade`")
    @ApiModelProperty(value = "等级评价")
    private String grade;

    @Column(name = "`is_enable`",nullable = false)
    @NotNull
    @ApiModelProperty(value = "是否激活")
    private Boolean isEnable;

    @Column(name = "`audit_status`")
    @ApiModelProperty(value = "审核状态")
    private Integer auditStatus;

    @Column(name = "`audit_result`")
    @ApiModelProperty(value = "审核结果信息")
    private String auditResult;

    @Column(name = "`audit_time`")
    @CreationTimestamp
    @ApiModelProperty(value = "审核时间")
    private Timestamp auditTime;

    @Column(name = "`registration_time`")
    @CreationTimestamp
    @ApiModelProperty(value = "注册时间")
    private Timestamp registrationTime;

    @Column(name = "`last_longin_time`")
    @UpdateTimestamp
    @ApiModelProperty(value = "最后登录时间")
    private Timestamp lastLonginTime;

    public void copy(DqDoctors source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        DqDoctors dqDoctors = (DqDoctors) o;
        return Objects.equals(id, dqDoctors.id) &&
                Objects.equals(realName, dqDoctors.realName);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, realName);
    }
}
